H=5;//current+H
ws=3;
gm=.9;
ngen=10;
ggsize=zeros(ngen+1,1);
ggrid=cell();
gepls=cell();
gmax=cell();
gmin=cell();
for k=0:ngen
    [fdg, err] = mopen("gen"+string(k)+".dat");
    [fdp, err] = mopen("path"+string(k)+".dat");
    ggsize(k+1)=strtod(mgetl(fdg,1));
    ggrid(k+1).entries=mgetl(fdg);
    gsize=ggsize(k+1);
    grid=ggrid(k+1).entries;
    mxw=zeros(ws,1);
    miw=zeros(ws,1);
    [s,pls]=atos2(genpls2([1;0;0],1));
    w1=evalr(pls);
    mxw(1)=w1(1);
    [s,pls]=atos2(genpls2([0;1;0],1));
    w1=evalr(pls);
    mxw(2)=w1(2);
    [s,pls]=atos2(genpls2([0;0;1],1));
    w1=evalr(pls);
    mxw(3)=w1(3);
    [s,pls]=atos2(genpls2([-1;0;0],1));
    w1=evalr(pls);
    miw(1)=w1(1);
    [s,pls]=atos2(genpls2([0;-1;0],1));
    w1=evalr(pls);
    miw(2)=w1(2);
    [s,pls]=atos2(genpls2([0;0;-1],1));
    w1=evalr(pls);
    miw(3)=w1(3);
    gmax(k+1).entries=mxw;
    gmin(k+1).entries=miw;
    mclose(fdg);
    expert=strtod(mgetl(fdp));
    mclose(fdp);
    gepls(k+1).entries=zeros(size(expert,1)-1,1);
    for i=2:size(expert,1)
        gepls(k+1).entries(i-1)=expert(i)-expert(i-1);
    end
//use part to search character
//define feature vectors for a state
//gen random weights
//find optimal strategy for weights ->write RL code add to policy list
//maximize weights for diff V
    //file("close", fdg);
    //file("close", fdp);
end
